package demo06;

import java.util.Random;
import java.util.Scanner;

public class Test01 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);

        Random rd=new Random();
        int sum=0;
        boolean flag=true;
        while (true){
            System.out.println("1,发牌");
            System.out.println("2,结束发牌");
            System.out.println("输入功能");
            int i = sc.nextInt();
            int r = rd.nextInt(14-1)+1;
            if (i==1){
                sum+=r;
                if (sum<=21){
                    System.out.println("手牌是："+r+"点数和是"+sum);
                }else {
                    System.out.println("点数和是："+sum+"游戏结束");
                    return;
                }

            }
            else {
                System.out.println("手牌的点数累加是"+sum);
                return;
            }
        }

    }
}
